#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<unordered_set>
#include<string>
using namespace std;
const int N = 110, P = 131;
using ull = unsigned long long;
unordered_set<ull> us;
ull h[N], p[N];
int n;
char s[N];
ull get(int l, int r)
{
    return h[r] - h[l - 1] * p[r - l + 1];
}
bool check(int len)
{
    int l = 1;
    for (; l + len - 1 <= n; l++)
    {
        int r = l + len - 1;
        ull hash = get(l, r);
        if (us.count(hash) == 1) return false;
        us.insert(hash);
    }
    return true;
}
int main()
{
    scanf("%d", &n);
    scanf("%s", s + 1);
    int res = n;
    p[0] = 1;
    for (int i = 1; i <= n; i++)
    {
        p[i] = p[i - 1] * P;
        h[i] = h[i - 1] * P + s[i];
    }
    int l = 1, r = n;
    while (l <= r)
    {
        int mid = l + r >> 1;
        if (check(mid)) r = mid;
        else l = mid + 1;
    }
    cout << r << endl;
    return 0;
}